package com.ssy.jt808.gateway.sdk.terminal.constant.location.addition;

import java.util.Map;
import java.util.TreeMap;

/**
 * adas alarm 驾驶辅助功能报警信息
 *
 * @author wangzezhou
 */
public enum AdasAlarmEnum{

  /** 前向碰撞预警 */
  ForwardCollisionWarning(0x01),
  /** 车道偏离报警 */
  LaneDeparture(0x02),
  /** 车距过近报警 */
  VehicleTooClose(0x03),
  /** 行人碰撞报警 */
  PedestrianCollision(0x04),
  /** 频繁变道报警 */
  LaneChangeFrequently(0x05),
  /** 道路标识超限报警 */
  RoadSignOverLimit(0x06),
  /** 障碍物报警 */
  Obstacle(0x07),
  /** 驾驶辅助功能失效报警 */
  AdasFailure(0x08),
  /** 道路标志识别事件 */
  RoadSignRecognitionEvent(0x10),
  /** 主动抓拍事件 */
  CaptureProactively(0x11),

  /** 碰撞 */
  Crash(0x1E),

  /** 侧翻 */
  Rollover(0x1F);

  AdasAlarmEnum( int type ){
    this.type = type;
  }

  private final int type;

  public int type(){
    return type;
  }


  private static final Map<Integer,AdasAlarmEnum> TYPE_MAP;

  static{
    TYPE_MAP = new TreeMap<>();
    AdasAlarmEnum[] values = AdasAlarmEnum.values();
    for(AdasAlarmEnum value : values){
      TYPE_MAP.put(value.type(), value);
    }
  }

  public static AdasAlarmEnum type( int type ){
    AdasAlarmEnum AdasAlarmEnum = TYPE_MAP.get(type);
    assert AdasAlarmEnum != null;
    return AdasAlarmEnum;
  }
}
